package com.wxfbboy.wiki.controller;

import com.wxfbboy.wiki.domain.Test;
import com.wxfbboy.wiki.service.TestService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/test")
public class TestController {

    @Resource
    private TestService testService;

    @Value("${test.hello}")
    private String testHello;

    @GetMapping("/")
    public String hello(){
        return "Hello World";
    }

    @PostMapping("/post")
    public String helloPost(String name){
        return "Hello World!Post: "+ testHello;
    }

    @GetMapping("/list")
    public List<Test> list(){
        return testService.list();
    }
}
